home *** CD-ROM | disk | FTP | other *** search
/ Apple Developer Connection Student Program / ADC Tools Sampler CD Disk 3 1999.iso / Documentation / Books / Learn Java on the Macintosh / Learn Java Projects / 11.03 - paint circle / SimpleDraw.java < prev    next >
Text File  |  1996-04-22  |  626b  |  26 lines

  1. /* -------------------------------------------------------------
  2. This applet paints a red circle.
  3.  
  4. Java's classes: Applet    (applet)
  5.                 Graphics  (awt)     used for drawing
  6.                 Color     (awt)     defines colors
  7.  
  8. Custom classes: SimpleDraw
  9.  
  10. ------------------------------------------------------------- */
  11.  
  12. import java.applet.Applet;
  13. import java.awt.*;
  14.  
  15. public class SimpleDraw extends Applet {
  16.  
  17.    /** Draw a red circle when the applet paints itself. */
  18.    public void paint(Graphics g) {
  19.       g.setColor(Color.red);
  20.       g.fillOval(115, 55, 40, 40); // x = 115, y = 115, radius = 40
  21.    }
  22.    
  23. }
  24.  
  25.  
  26.